{% extends 'TopxiaWebBundle:LiveCourse:layout.html.twig' %}

{% block title %}直播 - {{ parent() }}{% endblock %}

{% set script_controller = 'live-course/index' %}

{% block live_main %}

  {% if paginator.currentPage == 1 %}
    <div class="homepage-feature homepage-feature-slides mbl">
      <div class="cycle-pager"></div>
      	{{ block_show('live_top_banner') }}
    </div>
  {% endif  %}

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">近期直播</h3>
    </div>
    <div class="panel-body">
      {% if recentCourses %}
        {{ render(controller('TopxiaWebBundle:LiveCourse:coursesBlock', {courses:recentCourses, view: 'list'})) }}
      {% else %}
        <div class="empty">近期还没有直播</div>
      {% endif %}

      {{ web_macro.paginator(paginator) }}
    </div>
  </div>

{% endblock %}

{% block live_side %}

  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title">最新上线</h3>
    </div>
    <div class="panel-body">
      <ul class="media-list media-list-rank">
        {% for course in liveCourses %}
        <li class="media">
          <a href="{{ path('course_show', {id:course.id}) }}" class="pull-left">
            <img src="{{ filepath(course.smallPicture, 'course.png') }}" class="media-object" width="96" height="54">
          </a>
          <div class="media-body">
            <h5 class="media-heading"><a href="{{ path('course_show', {id:course.id}) }}">{{ course.title }}</a></h5>
            {% set teacher = users[course.teacherIds|first]|default(null) %}
            {% if teacher %}
              <p>
              <span class="glyphicon glyphicon-user text-muted"></span>
                <a class="text-muted" href="{{ path('user_show', {id:teacher.id}) }}">{{ teacher.nickname }}</a>
              </p>
            {% endif %}
          </div>
        </li>
        {% else %}
          <li class="empty">还没有发布的直播课程</li>
        {% endfor %}
      </ul>
    </div>
  </div>

  {{ render(controller('TopxiaWebBundle:LiveCourse:ratingCoursesBlock')) }}

{% endblock %}
